package com.blobfish.fiction.common.pipeline;

import com.blobfish.fiction.common.util.InitPluginUtil;
import com.jfinal.kit.PropKit;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

import java.util.List;

public class XicidailiPipeline implements Pipeline {

    @Override
    public void process(ResultItems resultItems, Task task) {
        List<String> ipList = resultItems.get("ipList");
        InitPluginUtil.getInstance().initRedisPlugin().sadd(PropKit.get("proxyIpList"), ipList.stream().toArray(String[]::new));
    }
}
